#ifndef __SCHED_RR2__
#define __SCHED_RR2__

#include <vector>
#include <queue>
#include "basesched.h"
#include <utility>
#include <fstream>

class SchedRR2 : public SchedBase {
	public:
		SchedRR2(std::vector<int> argn);
        ~SchedRR2();
		virtual void load(int pid);
		virtual void unblock(int pid);
		virtual int tick(int cpu, const enum Motivo m);

	private:
		int next(int cpu);
		int minCpu();
		int tareasActivas(std::vector<std::pair <int,int> > cpuXTarea, int cpu);
		int getCpu(std::vector<std::pair <int,int> > cpuXTarea, int pid);
		int cores;	/*Cantidad de cores*/
		std::vector<int> quantum;	/*Quantum del core i */
		std::vector<int> quantum_left;	/*Quantum restante del core i */
		std::vector<std::queue <int> > tareasCPU;	/*Cola de tareas (una sola, para permitir la migracion)*/
		std::vector<std::pair <int,int> > cpuXtareas;


};

#endif
